using System;

using Microsoft.Cci;
using Microsoft.FxCop.Sdk.Introspection;

namespace Tyng.Rules
{
    public abstract class PropertyRuleBase<T> : RuleBase<T>
        where T : PropertyRuleBase<T>
    {
        protected PropertyRuleBase()
        {
        }

        public override sealed ProblemCollection Check(Member member)
        {
            Property property = member as Property;
            ProblemCollection returnValue = new ProblemCollection(this);

            if (property == null || !ShouldCheckProperty(property))
                return null;

            return Check(property);
        }

        protected virtual bool ShouldCheckProperty(Property property)
        {
            return true;
        }

        protected abstract ProblemCollection Check(Property property);

    }
}
